{extend name="layout" /}
{block name="body"}
<div class="row">
    <div class="col-lg-12">
        <div class="card">
            <div class="card-body">
                <form action="{:url('/admin/notes/queryapp')}" method="post">
                    <div class="form-group">
                        <label for="id">笔记id</label>
                        <input type="text" class="form-control" id="id" value="{$notes.id}" disabled>
                    </div>
                    <div class="form-group">
                        <label for="appname">笔记标题</label>
                        <input type="text" class="form-control" id="title" value="{$notes.title}" placeholder="请输入应用名称">
                    </div>
                    <div class="form-group">
                        <label for="hierarchy">笔记内容</label>
                        <textarea class="form-control" aria-label="With textarea" id="content" placeholder="笔记内容"
                            style="height: 200px;">{$notes.content}</textarea>
                    </div>
                    <div class="form-group">
                        <label for="ip">提交ip地址</label>
                        <input type="text" class="form-control" id="ip" value="{$notes.ip}" disabled>
                    </div>
                    <div class="form-group">
                        <label for="creattime">创建时间</label>
                        <input type="text" class="form-control" id="creattime" value="{$notes.creattime}" disabled>
                    </div>
                    <div class="form-group">
                        <label for="updatetime">最新修改时间</label>
                        <input type="text" class="form-control" id="updatetime" value="{$notes.updatetime}" disabled>
                    </div>
                    <div class="form-group">
                        <label for="username">创建用户</label>
                        <input type="text" class="form-control" id="username" value="{$notes.username}" disabled>
                    </div>

                    <div class="form-group">
                        <label for="appname">应用名称</label>
                        <input type="text" class="form-control" id="appname" value="{$notes.appname}" disabled>
                    </div>
                    <button type="button" onclick="updateapp()" class="btn btn-w-sm btn-primary mb-2">提交</button>
                    <button type="button" class="btn btn-default mb-2"
                        onclick="javascript:history.back(-1);return false;">返 回
                    </button>
                </form>
            </div>
        </div>
    </div>
</div>
{/block}
{block name="js"}
<script>
    function updateapp() {
        var l = $('body').lyearloading({
            opacity: 0.2,
            spinnerSize: 'lg',
            spinnerText: '后台处理中，请稍后...',
            textColorClass: 'text-info',
            spinnerColorClass: 'text-info'
        });
        var id = $.trim($("#id").val());
        var title = $.trim($("#title").val());
        var content = $.trim($("#content").val());
        $.ajax({
            type: "POST",
            url: "{:url('notes/edit')}",
            data: {
                id: id,
                title: title,
                content: content
            },
            dataType: "json",
            success: function (data) {
                setTimeout(function () {
                    l.destroy();
                }, 1e3)
                if (data.code == 1) {
                    notify.success(data.msg, function () {
                        location.reload();
                    },1000);
                } else {
                    notify.error(data.msg);
                }
            },
            error: function () {
                l.destroy();
                notify.error("系统错误");
            }
        })
    }
</script>
{/block}